package com.xzw.controller.author;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xzw.dao.impl.NovelDaoImpl;
import com.xzw.domain.Novel;
import com.xzw.domain.User;

public class AuthorMgNovel extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		User author = (User) request.getSession().getAttribute("whologin");
		
		String aname = author.getNickname();
		NovelDaoImpl dao = new NovelDaoImpl();
		List<Novel> works =dao.findByAname(aname);
		int workssize = works.size();
		
		request.setAttribute("works", works);
		request.setAttribute("workssize", workssize);
		request.getRequestDispatcher("/WEB-INF/author/authorMgNovel.jsp").forward(request, response);

	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

}
